﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewsList.aspx.cs" Inherits="Manage_Modle_News_NewsList" %>
<%@ Register Src="~/Manage/UserControl/PagingCtrl.ascx" TagName="PagingCtrl" TagPrefix="UserControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta content="MSHTML 6.00.2900.3132" name="GENERATOR" />
	<link href="../../css/mainFrom.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/common.js"></script>
	    <script language="javascript" type="text/javascript">
        parent.$("IFRAME_windowTab_<%=ROLESTR%><%=strPermissionID %>").style.height = "560px";
    </script>
	<script type="text/javascript" language="javascript">
	        function ExpandSubCategory(iCategoryID,FahterID)
		    {
  
			    var li_father = document.getElementById("li_" + iCategoryID);
			    if (li_father.getElementsByTagName("li").length > 0) //如果已经加载了下级节点则直接展开，不必在去读取数据
			    {
				    ChangeStatus(iCategoryID);
				    return;
			    }
    			
			    li_father.className = "Opened";
			    //打开时显示稍等
			    switchNote(iCategoryID, true);
			    //AJAX回调函数，加载节点
			    
			    Dcms.BLL.Dcms_CateBLL.GetSubCategory(iCategoryID,'<%=Language %>', GetSubCategory_callback);				
		    }
            function ExpandSubCategoryAgain(iCategoryID,FahterID)
		    {

			    var li_father = document.getElementById("li_" + iCategoryID);
			    li_father.className = "Opened";
			    //打开时显示稍等
			    switchNote(iCategoryID, true);
			    //AJAX回调函数，加载节点
			    
			    Dcms.BLL.Dcms_CateBLL.GetSubCategory(iCategoryID,'<%=Language %>', GetSubCategory_callback);				
		    }
		    function GetSubCategory_callback(response)
		    {
			    var dt = response.value.Tables[0];
			    if (dt.Rows.length > 0)
			    {
				    var iCategoryID = dt.Rows[0].Cate_ParentID;
			    }
			    var li_father = document.getElementById("li_" + iCategoryID);
			    var ul_sub = document.getElementById("ulTree_" + iCategoryID); 
			    if(ul_sub != null){
			        li_father.removeChild(ul_sub)
			    }
			    var ul = document.createElement("ul");
			    ul.id = "ulTree_"+ iCategoryID
			    for (var i = 0;i < dt.Rows.length;i++)
			    {
					var li = document.createElement("li");
				    if (dt.Rows[i].Cate_IsChild == 1) //如果已没有下一级节点
				    {
					    li.className = "Child";
					    li.id = "li_" + dt.Rows[i].Cate_ID;
    					
					    var img = document.createElement("img");
					    img.id = dt.Rows[i].Cate_ID;
					    img.className = "s";
					    img.src = "../../css/s.gif";
    					
					    var a = document.createElement("a");
					    var id = dt.Rows[i].Cate_ID;
    					if(dt.Rows[i].Cate_Flag == "NESINDEXIMAGE"){
    					    a.href = "javascript:OpenDocument('" + dt.Rows[i].Cate_ID + "','LOOKIMAGE');";
    					}else if(dt.Rows[i].Cate_Flag == "NEWSINDEXLIST"){
    					    a.href = "javascript:OpenDocument('" + dt.Rows[i].Cate_ID + "','LOOKINDEX');";
    					}else{
					        a.href = "javascript:OpenDocument('" + dt.Rows[i].Cate_ID + "','LOOKLIST');";
					    }
					    a.innerHTML = dt.Rows[i].Cate_Name.sub(14);
					    
					    var imgNew = document.createElement("img");
				        imgNew.id = dt.Rows[i].Cate_ID;
				        imgNew.className = "s_1";
				        imgNew.src = "../../images/new.gif";
				        imgNew.onclick = function () {
					        OpenEditPage(this.id,"add");
				        };
				        imgNew.alt = "新建信息";
				        <% if (CL.IsAdd(ROLESTR)==false) {%>
				            imgNew.style.display="none";
				        <%} %>
				        imgNew.width = 15;
				        imgNew.height = 15;
				        
				        var imgCopy = document.createElement("img");
				        imgCopy.id = dt.Rows[i].Cate_ID;
				        imgCopy.className = "s_1";
				        imgCopy.src = "../../images/copyfile.gif";
				        imgCopy.onclick = function () {
					        OperateCate(this.id,"copy");
				        };
				        imgCopy.alt = "复制该分类下所有数据到其它分类下";
				        
				        var imgMove = document.createElement("img");
				        imgMove.id = dt.Rows[i].Cate_ID;
				        imgMove.className = "s_1";
				        imgMove.src = "../../images/movefile.gif";
				        imgMove.onclick = function () {
					        OperateCate(this.id,"move");
				        };
				        imgMove.alt = "移动该分类下所有数据到其它分类下";
				    }
				    else    //如果还有下级节点
				    {
					    li.className = "Closed";
					    li.id = "li_" + dt.Rows[i].Cate_ID;
    					
					    var img = document.createElement("img");
					    img.id = dt.Rows[i].Cate_ID;
					    img.className = "s";
					    img.src = "../../css/s.gif";
					    img.onclick = function () {
						    ExpandSubCategory(this.id);
					    };
					    img.alt = "展开/折叠";
    					
					    var a = document.createElement("a");
					    a.href = "javascript:ExpandSubCategory(" + dt.Rows[i].Cate_ID + ",'LOOKLIST');";
					    a.innerHTML = dt.Rows[i].Cate_Name.sub(14);
					    
				    }
				    li.appendChild(img);
				    li.appendChild(a);
				    if(dt.Rows[i].Cate_IsChild == 1)
				    {
			            li.appendChild(imgCopy);
			            li.appendChild(imgMove);
			        }
				    if(dt.Rows[i].Cate_IsChild == 1 && dt.Rows[i].Cate_OpType!="NOADMIN"){
				        li.appendChild(imgNew);
				    }
				    ul.appendChild(li);	
			    }
			    
			    var li = document.createElement("li");
			    li.className = "Child";
			    li.id = "li_Sec";
				
			    var img = document.createElement("img");
			    img.id = "Img_Sec";
			    img.className = "s";
			    img.src = "../../css/s.gif";
				
			    var a = document.createElement("a");
			    var id = "a_Sec";
			    a.href = "javascript:OpenOther('newSec.aspx');";
			    a.innerHTML ="新闻查找";
			    li.appendChild(img);
				li.appendChild(a);
				ul.appendChild(li);	
			    
			    li_father.appendChild(ul);
			    //先显示稍等。。。
			    switchNote(iCategoryID, false);
		    }
    		
		    // 叶子节点的单击响应函数
		    function OpenOther(Url)
		    {
			    window.EditMain.location.href = Url;
		    }
		    
		    //移动或复制分类
		    function OperateCate(iCategoryID, Action)
		    {
			    window.EditMain.location.href = "../CateGory/OperateCate.aspx?CatID="+iCategoryID + "&action="+Action;
		    }
		    
		    function OpenDocument(iCategoryID,Action)
		    {
			    window.EditMain.location.href = "ListNews<%=strModelKeyID %>.aspx?PermissionID=<%=strPermissionID %>&TopCateID=<%= strTopCateID%>&CatID="+iCategoryID;
		    }
            function OpenEditPage(iCategoryID,Action)
		    {
			    window.location.href = "EditNews<%=strModelKeyID %>.aspx?PermissionID=<%=strPermissionID %>&TopCateID=<%= strTopCateID%>&CatID="+iCategoryID + "&action=" + Action;
			    
		    }
		    function ChangeStatus(iCategoryID)
		    {
			    var li_father = document.getElementById("li_" + iCategoryID);
			    if (li_father.className == "Closed")
			    {
				    li_father.className = "Opened";
			    }
			    else
			    {
				    li_father.className = "Closed";
			    }				
		    }

		    function switchNote(iCategoryID, show)
		    {
			    var li_father = document.getElementById("li_" + iCategoryID);
			    if (show)
			    {
				    var ul = document.createElement("ul");
				    ul.id = "ul_note_" + iCategoryID;
    				
				    var note = document.createElement("li");
				    note.className = "Child";
    				
				    var img = document.createElement("img");
				    img.className = "s";
				    img.src = "../../css/s.gif";
    				
				    var a = document.createElement("a");
				    a.href = "javascript:void(0);";
				    a.innerHTML = "请稍候...";
    				
				    note.appendChild(img);
				    note.appendChild(a);
				    ul.appendChild(note);
				    li_father.appendChild(ul);
			    }
			    else
			    {
				    var ul = document.getElementById("ul_note_" + iCategoryID);
				    if (ul)
				    {
					    li_father.removeChild(ul);
				    }				
			    }
		    }

            function InitTree()
            {
		        // 加载根节点
		        var tree = document.getElementById("CategoryTree");
		        var root = document.createElement("li");
		        root.id = "li_<%=TerrFatherID %>";
		        tree.appendChild(root);
        		var ID = <%=TerrFatherID %>;
		        // 加载页面时显示第一级分类
		        ExpandSubCategory(ID);
		    }
    </script>
</head>
<body onload="InitTree()">
    <form id="form1" runat="server">
    <div id="incontent">
      <div class="clear"></div>
      <div class="contable">
        <div class="con-ico">
          <div class="con-fl">当前位置：<asp:Literal ID="litTitle" runat="server" Text="新闻信息管理"/><asp:Label ID="labNowJour" runat="server" ForeColor="red" /></div>
          <div class="con-fr">
            <img src="../../images/img-fontid.gif" title="本页技术支持编号" alt="" />010500
          </div>
        </div>
        <div class="clear"></div>
        <div class="hr"></div>
        <div class="imgadnfont">
          <div class="float">
            <img src="../../images/UserloginLog.gif" alt="" />
          </div>
          <div style="line-height: 20px;">
            在这里主要是管理网站上一些简单的，类似公司简介等的一些信息。这些信息般更新比较少，所有的栏目多和前台相应的栏目对应，如需更动栏目，需要设计师的帮助。
          </div>
        </div>
        <div class="clear"></div>
          <div id="leftCate" style="width:200px; float:left">
            <div class="TreeMenu" id="CategoryTree">
              
		    </div>    
		    <input type="hidden" id="TextBox1" runat="server" name="节点ID" /><br />
            <input type="hidden" id="TextBox2" runat="server" name="父节点ID" /><br />
          </div>
          <div id="RightCate" style="width:530px; float:left">
           <iframe frameborder="0" style="width:530px; height:350px;" src="ListNews<%=strModelKeyID %>.aspx" id="EditMain" name="EditMain"></iframe>
          </div>
        </div>

    </div>

    <script language="javascript" type="text/javascript">
        var strCateID = <%= (Request.QueryString["CatID"] + "") %>;
        if(strCateID != "")
        {
            OpenDocument(strCateID, "edit");
        }
    </script>
    </form>
</body>
</html>
